<template>
	<view>
		<view class="searchInput pd">
			<safeTopVue :backgroundColor="'var(--homePageBackground)'" />
			<view class="rowStart" style="gap: 20rpx;">
				<uv-icon name="arrow-left" @click="back"></uv-icon>
				<view class="w100 pd" style="background-color: var(--themeDefultBackground);">
					<uv-input placeholder="请输入人员名称" prefixIcon="search" border="none" @change='change'
						 prefixIconStyle="font-size: 22px;color: #909399"></uv-input>
				</view>
			</view>
		</view>
		<view class="cloummStart mtb30" v-if="prediceList.length>0">
			<view>
				<collapseTopVue :mode="'top'" :showIdent="true" :index='index' :items="item"
					v-for="(item,index) in prediceList" :key="item.id" />
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue';
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		predictListApi
	} from '@/api/agentApi/predict.js'
	import searchInputVue from '@/components/searchInput/searchInput.vue';
	import collapseTopVue from '../homecomponents/collapseTop.vue';
	import {
		transformDataStructure,
		dataList
	} from '@/untils/predictDataUtils.js'
	const searchValue = ref('')
	const isShowResult = ref(false)
	// 佣金列表
	let prediceList = ref([])
	// 获取佣金列表的参数
	let getPredictInfo = reactive({
		endTime: '',
		isAsc: '',
		nickName: '',
		pageNum: 1,
		pageSize: 10,
		parentUserId: '',
		startTime: '',
		userIds: []
	})
	// 获取佣金列表
	const predictList = async () => {
		let res = await predictListApi(getPredictInfo)
		prediceList.value = transformDataStructure(res.data.list, dataList)
		console.log(prediceList.value);
	}
	const back = () => {
		uni.navigateBack({
			delta: 1
		})
	}
	const change = (e) => {
		console.log(e);
		getPredictInfo.nickName = e
		predictList()
	}
	onLoad(() => {
		// predictList()
	})
</script>

<style lang="scss" scoped>
	.searchInput {
		background-color: #fff;
	}

	.pd {
		padding: 20rpx;
		box-sizing: border-box;
	}
</style>